<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <link rel="icon" href="images/index.ico">
    <title>商家页面</title>
    <!-- Bootstrap core CSS -->
    <link href="bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="css/merchant.css" rel="stylesheet">
    <link href="css/merchantCart.css" rel="stylesheet">
    <script src="bower_components/angular/angular.min.js"></script>
</head>
<body ng-app="mainApp" ng-controller="userCtrl">
<!-- Header -->
<nav class="navbar navbar-fixed-top">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
                    aria-expanded="false" aria-controls="navbar"><span class="sr-only">Toggle navigation</span> <span
                    class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span></button>
            <a class="navbar-brand logo" href="home.html"><img id="logo" src="images/logo.png" alt=""/></a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav navbar-right">
                <li ng-show="hasLogin">
                    <a href="userInfo.html">Welcome {{userAccount}}</a>
                </li>
                <li ng-hide="hasLogin"><a href="login.html"><span class="glyphicon glyphicon-user"></span> 登录</a></li>
                <li ng-hide="hasLogin"><a href="register.html"><span class="glyphicon glyphicon-inbox"></span> 注册</a></li>
                <li><a href="home.html"><span class="glyphicon glyphicon-home"></span> 主页</a></li>
                <li ng-show="hasLogin"><a href="order.html"><span class="glyphicon glyphicon-th-list"></span> 我的订单</a></li>
                <li ng-show="hasLogin"><a ng-click="logOut()"><span class="glyphicon glyphicon-log-out"></span> 退出</a></li>
            </ul>
        </div>
        <!--/.nav-collapse -->
    </div>
</nav>
<div ng-controller="CartController">
<!-- Merchant Infomation -->
<div class="container" ng-controller="MerchantController">
    <div class="col-md-12">
        <div id = "merchantInfo" class="alert alert-info" role="alert">
            <img id="mIcon" src="{{merchant.icon}}" alt="{{merchant.icon}}">
            <h1>{{merchant.shopName}}</h1>
            <span>销售量：{{merchant.orderNumber}}</span>
            <span>星级：
                <img src="images/fullStar.gif" ng-repeat="s in star">
            </span>
            <span>地址：{{merchant.address}}</span>
        </div>
    </div>

</div>


<div class="container content">
    <div class="row row-offcanvas row-offcanvas-right">
        <div class="col-xs-12 col-sm-9">
            <div class="row" id="dishDiv">

                <div class="col-xs-6 col-lg-4 item" ng-repeat="d in dishes">
                    <img class="img" src="{{d.dicon}}" alt="{{d.dicon}}">
                    <h4>{{d.dname}}</h4>
                    <p>￥ {{d.price}}</p>
                    <button class="btn btn-primary" ng-click="addToCart($index)">加入购物车</button>
                </div>

            </div>
            <!--/row-->
        </div>
        <!--/.col-xs-12.col-sm-9-->
        <!-- Cart -->
        <div class="col-xs-6 col-sm-3 sidebar-offcanvas" id="sidebar">
            <div id="cartIcon">
                <div id="left">
                    <span id="notify">{{num}}</span>
                </div>
                <div id="right"><img src="images/cart.png" alt=""/></div>
            </div>
            <div class="list-group"> <a href="#" class="list-group-item active">购物车</a>
                <div id="cartDiv">

                    <a href="#" class="list-group-item cartItem" ng-repeat="c in carts">
                        <span>{{c.item.dname}}</span>
                        <button ng-click="addDish($index)">+</button>
                        <input type="text" ng-model="c.count">
                        <button ng-click="deleteDish($index)">-</button>
                        <span>￥{{c.item.price}}</span>
                    </a>

                </div>
                <a href="#" class="list-group-item cartItem"> <span id="cartTotal">Total : ￥{{total}}</span>
                    <button id="check" ng-click="check()">Check</button>
                </a>
            </div>
        </div>
        <!--/.sidebar-offcanvas-->
    </div>
    <!--/row-->
</div>
<!-- /.container -->
<div id="overdiv" ng-show="showList">
    <div id="innerdiv">
        <div id="intotal">
            <button class="btn btn-primary" ng-click="exitList()" style="margin-left:5px">退出</button>
            <button class="btn btn-primary" ng-click="submitOrder()">提交订单</button> <span id="orderTotal">总价：{{total}}</span> </div>
        <div id="orderDiv">

            <div class="initem" ng-repeat="c in carts">
                <img class="in_img" src="{{c.item.dicon}}" alt="{{c.item.dicon}}">
                <span>{{c.item.dname}}</span>
                <span>￥{{c.item.price}}</span>
                <span>Number : {{c.count}}</span>
            </div>

        </div>
        <div id="addrDiv">
            <span>地址:</span>
            <input type="text" ng-model="ca.address">
            <button ng-click="addAddress()">增加</button>
            <ul class="list-group">
                <li class="list-group-item" ng-repeat="a in address">
                    <span>{{a.address}}</span>
                    <button ng-click="editAddress($index)">选择</button>
                    <button ng-click="deleteAddress($index)">删除</button>
                </li>
            </ul>
        </div>
    </div>
</div>
</div>
</div>
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="js/session.js"></script>
<script src="js/merchantCart.js"></script>
<script src="js/merchant.js"></script>
</body>

</html>